import 'package:flutter/material.dart';
import 'package:jd_shopping/services/ScreenAdaper.dart';
import 'package:jd_shopping/pages/Coustom/JdButton.dart';
import 'package:jd_shopping/pages/Tabs.dart';

class ReginThree extends StatefulWidget {
  @override
  _ReginThreeState createState() => _ReginThreeState();
}

class _ReginThreeState extends State<ReginThree> {
  bool _checkBox = false;

  @override
  Widget build(BuildContext context) {
    ScreenAdaper.init(context);
    Widget buildTextField() {
      return Container(
        padding: const EdgeInsets.all(1.0),
        alignment: Alignment.center,
        height: ScreenAdaper.height(80),
        decoration: new BoxDecoration(
          //color: Colors.grey,
          border: new Border.all(color: Colors.grey, width: 1.0),
          //borderRadius: new BorderRadius.circular(12.0)
        ),
        child: TextField(
          decoration: InputDecoration(
              hintText: '请设置为6-20位字符',
              contentPadding: const EdgeInsets.symmetric(vertical: 10.0),
              border: OutlineInputBorder(borderSide: BorderSide.none)),
          onTap: () {},
        ),
      );
    }

    return Scaffold(
      appBar: AppBar(title: Text('手机快速注册')),
      body: ListView(
        children: [
          SizedBox(height: ScreenAdaper.height(60)),
          Container(
            margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
            child: Text(
              '请设置登录密码',
              style: TextStyle(color: Colors.grey, fontSize: 15),
            ),
          ),
          SizedBox(height: ScreenAdaper.height(20)),
          Container(
              margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
              height: ScreenAdaper.height(80),
              child: buildTextField()),
          SizedBox(height: ScreenAdaper.height(20)),
          Container(
            child: Row(
              children: [
                Container(
                  margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
                  width: ScreenAdaper.width(40),
                  child: Container(
                   // decoration: BoxDecoration(
                        //shape: BoxShape.circle, color: Colors.pink),
                    child: Checkbox(
                      value: this._checkBox,
                      activeColor: Colors.pink,
                      checkColor: Colors.white,
                      onChanged: (val) {
                        setState(() {
                          this._checkBox = !this._checkBox;
                        });
                      },
                    ),
                  ),
                ),
                Text(
                  '密码可见',
                  style: TextStyle(
                      color: Colors.black,
                      fontSize: 15,
                      fontWeight: FontWeight.bold),
                ),
              ],
            ),
          ),
          SizedBox(height: ScreenAdaper.height(10)),
          Container(
            margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
            child: Text(
              '密码由6-20位字母，数字或半角符号组成，不能是10位以下纯数字/字母/半角符号，字母需区分大小写',
              style: TextStyle(color: Colors.black, fontSize: 12),
            ),
          ),
          SizedBox(height: ScreenAdaper.height(10)),
          JdButton(
            color: Colors.red,
            text: '下一步',
            cb: () {
             Navigator.of(context).pushAndRemoveUntil(
                    MaterialPageRoute(builder: (context) =>  Tabs()),
                    (route) => route == null);
            },
          ),
          SizedBox(height: ScreenAdaper.height(30)),
          Container(
              margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
              child: Row(
                children: <Widget>[
                  Text('遇到问题你可以'),
                  InkWell(
                    child: Text(
                      '联系客服',
                      style: TextStyle(
                        decoration: TextDecoration.underline,
                      ),
                    ),
                    onTap: () {
                      print('联系客服');
                    },
                  )
                ],
              ))
        ],
      ),
    );
  }
}
